﻿namespace OOP
{
    using System;

    public class Display
    {
        private float? size;
        private string color;

        public Display()
        {
        }

        public Display(float size, string color)
        {
            this.Size = size;
            this.Color = color;
        }

        public float? Size
        {
            get
            {
                return this.size;
            }

            private set
            {
                if (value <= 0)
                {
                    throw new ArgumentOutOfRangeException("There is no existing display with \"{0}\" size.", value.ToString());
                }
                else
                {
                    this.size = value;
                }
            }
        }

        public string Color
        {
            get
            {
                return this.color;
            }

            private set
            {
                if (value == null)
                {
                    throw new ArgumentNullException("The color is incorrect.");
                }
                else if (value.Length <= 0)
                {
                    throw new ArgumentOutOfRangeException("The color is incorrect.");
                }
                else
                {
                    this.color = value;
                }
            }
        }

        public override string ToString()
        {
            return this.Size + Environment.NewLine + this.color;
        }
    }
}